//
//  CJViewController.swift
//  CJPack
//
//  Created by 陈警卫 on 2022/11/16.
//

import UIKit

class CJViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        view.backgroundColor = .white
        
        //let vc = view.cj_superIsKind(UIViewController.self)
        //kCJLog(vc)
        
        //let vc1 = view.cj_viewController()
        //kCJLog(vc1)
        
        //view.cj_addGradientColor(colors: [UIColor.white.cgColor, UIColor.yellow.cgColor, UIColor.red.cgColor], locations: nil, startPoint: CGPointMake(0, 0), endPoint: CGPointMake(1, 1))
        
        //view.cj.addGradientColorAnimation(startColors: [UIColor.white.cgColor, UIColor.yellow.cgColor, UIColor.red.cgColor], endColors: [UIColor.green.cgColor, UIColor.white.cgColor, UIColor.yellow.cgColor], locations: nil, startPoint: CGPointMake(0, 0), endPoint: CGPointMake(0, 1), duration: 5)
        
        let tv = UIView(frame: CGRectMake(100, 100, 100, 100))
        view.addSubview(tv)
        tv.backgroundColor = UIColor.cj_color(0x929292)
        tv.backgroundColor = UIColor.cj_color("929292")
        
        let b = UIButton(type: .custom)
        b.cj_addAction(closure: { btn in
            
        }, for: .touchUpInside)
        b.cj_addAction { btn in
            
        }
        
        let imgv = UIImageView(frame: CGRectMake(100, 100, 200, 200))
        imgv.contentMode = .scaleAspectFit
        view.addSubview(imgv)
        
        //cj_defaultImageName = "Ellipse 12"
        
        imgv.cj_sd_setImage("3333https://y.gtimg.cn/music/photo_new/T053R750x750M000001awz3d27N6WN.jpg?max_age=2592000")
        
        
        view.cj_setHolderView("空页面")
        

        //tv.cj_addGradientColor(colors: [UIColor.cj_color(0x929292).cgColor, UIColor.cj_color(0xDD2526).cgColor], locations: nil, startPoint: CGPointMake(0, 0), endPoint: CGPointMake(1, 0))
        
        // 45646 B24E
        let s = "B24E"
        print(s.contains("b"))
        
        
        print(Int(s, radix: 16)!)
        let s1 = s.cj_hexToDecimal
        print(s1)
        let s2 = s1.cj_decimalToHex
        let s3 = s1.cj_decimalToBinary
        print(s2)
        print(s3)
        
        let s4 = s.cj_hexToBinary
        print(s4)
        
        let s5 = s3.cj_binaryToHex
        let s6 = s3.cj_binaryToDecimal
        print(s5)
        print(s6)
        
        
        var t: UInt16 = 21122;
        let size = cj_sizeof(t)
        let data = Data(bytes: &t, count: size)
        print(data)
        
        var tn: UInt = UInt(bigEndian: UInt(t))
        let datan = Data(bytes: &tn, count: size)
        
        let data1 = t.cj_data()
        let data2 = t.cj_data(true)
        print(data1)
        print(data2)
        
        print(datan)
        
        print(data.cj_int)
        print(data.cj_uint())
        print(data.cj_uint8)
        print(data.cj_uint16)
        print(data.cj_uint32)
        
        let tHex = t.cj_hexString
        print(tHex)
        let tData = tHex.cj_hexData
        print(tData)
        print(tData.cj_int)
        print(tData.cj_uint())
        print(tData.cj_uint8)
        print(tData.cj_uint16)
        print(tData.cj_uint32)
        
        print(tData.cj_hexString())
        print(t.cj_binaryString)
        
        print(cj_sizeof(t))
        print(cj_sizeof(UInt8()))
        print(cj_sizeof(Int.self))
        
        let testArray: [Int32] = [1, 2, 3, 4]
        let arrayLength = cj_sizeofs(testArray)
        print(arrayLength)
        
        print(Int("1231.1") as Any)
        print(Int("1231") as Any)
        
        print("1231.5".cj_int)
        print("1231.5".cj_intRound)
        print("1231.5".cj_intCeil)
        print("1231.5".cj_intFloor)
        print("aa".cj_int)
        
        //let label = UILabel.cj_label()
        
        print(Date().cj_year)
        print(Date().cj_month)
        print(Date().cj_day)
        print(Date().cj_hour)
        print(Date().cj_minute)
        print(Date().cj_second)
        print(Date().cj_nanosecond)
        
        print(Date().cj_weekday)
        print(Date().cj_weekdayOrdinal)
        print(Date().cj_weekOfYear)
        print(Date().cj_weekOfMonth)
        print(Date().cj_quarter)
        print(Date().cj_isLeapMonth)
        
        print(Date().cj_dateAddYears(1))
        print(Date().cj_dateAddMonths(1))
        print(Date().cj_dateAddWeeks(1))
        print(Date().cj_dateAddDays(1))
        print(Date().cj_dateAddHours(1))
        print(Date().cj_dateAddMinutes(1))
        print(Date().cj_dateAddSeconds(1))
        
        
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
